<?php
$sanitize_all_escapes = true;
$fake_register_globals = false;
session_start();
$ignoreAuth = true;
include_once('../interface/globals.php');
?>
<html>
    <head>
        <?php html_header_show(); ?>
        <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
        <link rel="stylesheet" href="css/nightingale.css" type="text/css"/>
        <script language="javascript">
            parent.$("#eventos").load("get_encounters.php", {'embeddedScreen': true}, function() {
                parent.$("#eventos").css('display', 'block');
                parent.$("#reportes").css('display', 'none');
            });
            setTimeout(function() {
                parent.$.fancybox.close();
            }, 1000);
        </script>
    </head>

    <body class="body_top">
    <center>
        <p class="text">
            <?php
            if (isset($_REQUEST["encounter"])) {
                sqlStatement("UPDATE patient_provider_encounter SET encounter_auth_by_patient=1 WHERE encounter_id = {$_REQUEST["encounter"]}");
                $res = sqlStatement("select * from form_encounter where encounter={$_REQUEST["encounter"]}");
                $row = sqlFetchArray($res);
                
                sqlStatement("UPDATE patient_provider SET provider_connected_patient=1 where provider_id={$row["provider_id"]} and pid={$row["pid"]}");
                echo "Visita autorizada.";
            } else {
                echo "No se pudo autorizar la visita.";
            }
            ?>  
        </p>
        <p class="text">
            Este dialogo se cerrar&aacute; autom&aacute;ticamente...
        </p>
    </center>
</body>
</html>
